//
// Created by Administrator on 2022/1/18.
//

#ifndef RAPIDSVN_WIN_MYDIALOG_H
#define RAPIDSVN_WIN_MYDIALOG_H

#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/dialog.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/statline.h>
#include <wx/stattext.h>
#include <wx/listbox.h>
#include <wx/filepicker.h>
#include <wx/listctrl.h>
#include <wx/tglbtn.h>
#include "base.h"

enum {
    //ID_BUTTON_POST_MESSAGE
    ID_BUTTON_ADD_DIRECTORY,
    ID_REMOVE_ITEM
};

/*
 * FILE_NOTIFY_CHANGE_LAST_WRITE
        | FILE_NOTIFY_CHANGE_CREATION
        | FILE_NOTIFY_CHANGE_FILE_NAME
        | FILE_NOTIFY_CHANGE_DIR_NAME;
 */

class CReadDirectoryChanges;

//setup Token Id
class MyDialog: public wxFrame {
public:
    explicit MyDialog( wxWindow *parent );
    ~MyDialog() override;
    wxString getMonitorPath();

    CReadDirectoryChanges* getChanges();
private:
    //void OnStartPost( wxCommandEvent &event );
    wxVector<MonitorDIR> dirs;
    wxBoxSizer *dialogRootBoxSizer;

    //every panel
    wxPanel *m_panel;
    //wxTextCtrl* m_logBox;
    wxButton *button;
    wxDirPickerCtrl* m_filePicker1;
    //wxCheckBox* cb_isDelete;

    //dir list
    //wxBoxSizer* m_listbox;
    wxScrolledWindow* m_listbox;
    //wxListCtrl* listCtrlReport;
    void AddDirectory( wxCommandEvent &event );
    void OnActionEvent ( wxCommandEvent &event );

    int addDirectory( wxString dir, DWORD dwNotificationFlags );
    //background
    wxThread *workThread;

    void RemoveDir( wxCommandEvent &event );
    void demo(wxBoxSizer* wScrollSizer10 );

    void putDir( MonitorDIR dir );

    int init();

    CReadDirectoryChanges *changes;
    wxBoxSizer* wScrollSizer10;
    bool bTerminate;
    //start background run
    //how to
    //action_event: post
    //id
    void backgroundRun();
DECLARE_EVENT_TABLE()
};


#endif //RAPIDSVN_WIN_MYDIALOG_H
